import { observable, action } from "mobx";

class RootStore {
    // observable 表示数据可监控 表示是全局数据
    // 手机号码
    @observable mobile = "";
    // @observable mobile = "17398890639";
    // token
    @observable token = "";
    // @observable token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTE2NCwibmFtZSI6IjE3Mzk4ODkwNjM5IiwiaWF0IjoxNjE0NjE1MzE1LCJleHAiOjE2NDA1MzUzMTV9.4nbVz5Kn04Hopxa9lbAgyS0gYUDxBlTqJj0syI8k4bg";
    // 用户的唯一id
    @observable userId = "";
    // @observable userId = "173988906391614397537852";

    // action行为 表示 是个可以修改全局共享数据的方法
    @action setUserInfo(mobile, token, userId) {
        this.mobile = mobile;
        this.token = token;
        this.userId = userId;
    }

    // 清除信息
    @action clearUserInfo() {
        this.mobile = "";
        this.token = "";
        this.userId = "";
    }
}

export default new RootStore();